#include<bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin >> s;
	map<char, int>mp;
	int ret = 0;
	for(int i = 0; i < 3; i ++ ) {
		mp[s[i]] ++;
		ret = max(ret, mp[s[i]]);
	} 
	cout << 3 - ret << endl;
	return 0;
}

